package com.lemon.system.service.impl;

import com.lemon.common.core.utils.StringUtils;
import com.lemon.system.api.model.LoginUser;
import com.lemon.system.domain.SysUserOnline;
import com.lemon.system.service.ISysUserOnlineService;
import org.springframework.stereotype.Service;

/**
 * 在线用户 服务层处理
 * 
 * @author huangpeng
 */
@Service
public class SysUserOnlineServiceImpl implements ISysUserOnlineService {
    /**
     * 设置在线用户信息
     * 
     * @param user 用户信息
     * @return 在线用户
     */
    @Override
    public SysUserOnline loginUserToUserOnline(LoginUser user)
    {
        if (StringUtils.isNull(user))
        {
            return null;
        }
        SysUserOnline sysUserOnline = new SysUserOnline();
        sysUserOnline.setTokenId(user.getToken());
        sysUserOnline.setUserName(user.getUsername());
        sysUserOnline.setIpaddr(user.getIpaddr());
        sysUserOnline.setLoginTime(user.getLoginTime());
        sysUserOnline.setLoginSystem(user.getLoginSystem());
        return sysUserOnline;
    }
}
